package problems.rdmthreeobjectives;



public class RDMTransitionProb {

	
	double MC_MST[]= {0.9,0.88,0.92,0.9,0.85,0.83,0.87,0.85};
	double MR_MST[]= {0.91,0.93,0.89,0.91,0.93,0.95,0.91,0.93};
	double MP_MST[]= {0.9,0.85,0.92,0.87,0.88,0.83,0.9,0.85};
	
	double MC_RT[]= {0.86,0.84,0.88,0.86,0.73,0.71,0.75,0.73};
	double MR_RT[]= {0.95,0.97,0.93,0.95,0.97,0.99,0.95,0.97};
	double MP_RT[]= {0.82,0.75,0.84,0.77,0.8,0.73,0.82,0.75};
	
	/*double MC_MST[]= {0.9,0.88,0.92,0.9,0.85,0.83,0.87,0.85};
	double MR_MST[]= {0.65,0.55,0.6,0.55,0.6,0.55,0.35,0.45};
	double MP_MST[]= {0.9,0.85,0.92,0.87,0.88,0.83,0.9,0.85};
	
	double MC_RT[]= {0.86,0.84,0.88,0.86,0.73,0.71,0.45,0.35};
	double MR_RT[]= {0.95,0.97,0.93,0.95,0.97,0.99,0.95,0.97};
	double MP_RT[]= {0.82,0.75,0.84,0.77,0.8,0.73,0.55,0.45};*/
	
	double vec[];
	public static int random_int;
	public static int random_int1;
	public static int random_int2;
	public static int deviation;
	public static int deviation_timesteps;
	
	public RDMTransitionProb() {
		// TODO Auto-generated constructor stub
		
		vec=new double[8];
		
	}
	
	
	public double[] getCaseRT(int casenum)
	{
		
	    
		vec[0]=(MC_RT[casenum])*(MR_RT[casenum])*(MP_RT[casenum]);
		vec[1]=(MC_RT[casenum])*(MR_RT[casenum])*((1-MP_RT[casenum]));
		vec[2]=(MC_RT[casenum])*((1-MR_RT[casenum]))*(MP_RT[casenum]);
		vec[3]=(MC_RT[casenum])*((1-MR_RT[casenum]))*((1-MP_RT[casenum]));
		
		vec[4]=((1-MC_RT[casenum]))*(MR_RT[casenum])*(MP_RT[casenum]);
		vec[5]=((1-MC_RT[casenum]))*(MR_RT[casenum])*((1-MP_RT[casenum]));
		vec[6]=((1-MC_RT[casenum]))*((1-MR_RT[casenum]))*(MP_RT[casenum]);
		vec[7]=((1-MC_RT[casenum]))*((1-MR_RT[casenum]))*((1-MP_RT[casenum]));
		
		return vec;
		
	}
	
	///stable scenario
	public double[] getCaseMST(int casenum)
	{
		vec[0]=MC_MST[casenum]*MR_MST[casenum]*MP_MST[casenum];
		vec[1]=MC_MST[casenum]*MR_MST[casenum]*(1-MP_MST[casenum]);
		vec[2]=MC_MST[casenum]*(1-MR_MST[casenum])*MP_MST[casenum];
		vec[3]=MC_MST[casenum]*(1-MR_MST[casenum])*(1-MP_MST[casenum]);
		
		vec[4]=(1-MC_MST[casenum])*MR_MST[casenum]*MP_MST[casenum];
		vec[5]=(1-MC_MST[casenum])*MR_MST[casenum]*(1-MP_MST[casenum]);
		vec[6]=(1-MC_MST[casenum])*(1-MR_MST[casenum])*MP_MST[casenum];
		vec[7]=(1-MC_MST[casenum])*(1-MR_MST[casenum])*(1-MP_MST[casenum]);
		
	/*	System.out.println("Transistion probability");
		for(int i=0;i<vec.length;i++)
		{
			System.out.print(vec[i]+"  ");
		}
		System.out.println();*/
		
		return vec;
		
	}
	
	////detrimental scenario
	public double[] getCaseMSTDet(int casenum)
	{
		
		//System.out.println("deviation:::::::::::::::::"+ RDMTransitionProb.random_int+" Time::::"+RDMTransitionProb.deviation_timesteps);
	    double deviationvalue=MR_MST[casenum]*(random_int/100);
	    
	     
		vec[0]=MC_MST[casenum]*(MR_MST[casenum]-deviationvalue)*MP_MST[casenum];
		vec[1]=MC_MST[casenum]*(MR_MST[casenum]-deviationvalue)*(1-MP_MST[casenum]);
		vec[2]=MC_MST[casenum]*((1-MR_MST[casenum])+deviationvalue)*MP_MST[casenum];
		vec[3]=MC_MST[casenum]*((1-MR_MST[casenum])+deviationvalue)*(1-MP_MST[casenum]);
		
		vec[4]=(1-MC_MST[casenum])*(MR_MST[casenum]-deviationvalue)*MP_MST[casenum];
		vec[5]=(1-MC_MST[casenum])*(MR_MST[casenum]-deviationvalue)*(1-MP_MST[casenum]);
		vec[6]=(1-MC_MST[casenum])*((1-MR_MST[casenum])+deviationvalue)*MP_MST[casenum];
		vec[7]=(1-MC_MST[casenum])*((1-MR_MST[casenum])+deviationvalue)*(1-MP_MST[casenum]);
		
		/*System.out.println("Transistion probability");
		for(int i=0;i<vec.length;i++)
		{
			System.out.print(vec[i]+"  ");
		}
		System.out.println();*/
		
		return vec;
		
	}
	
	
	public double[] getCaseRTDet(int casenum)
	{
		/////change it to redundant topology
		//System.out.println("deviation:::::::::::::::::"+ RDMTransitionProb.random_int+" Time::::"+RDMTransitionProb.deviation_timesteps);
	    double deviationvalue1=MR_RT[casenum]*(random_int1/100);
	    double deviationvalue2=MR_RT[casenum]*(random_int2/100);
	    
		vec[0]=(MC_RT[casenum]-deviationvalue1)*(MR_RT[casenum])*(MP_RT[casenum]-deviationvalue2);
		vec[1]=(MC_RT[casenum]-deviationvalue1)*(MR_RT[casenum])*((1-MP_RT[casenum])+deviationvalue2);
		vec[2]=(MC_RT[casenum]-deviationvalue1)*((1-MR_RT[casenum]))*(MP_RT[casenum]-deviationvalue2);
		vec[3]=(MC_RT[casenum]-deviationvalue1)*((1-MR_RT[casenum]))*((1-MP_RT[casenum])+deviationvalue2);
		
		vec[4]=((1-MC_RT[casenum])+deviationvalue1)*(MR_RT[casenum])*(MP_RT[casenum]-deviationvalue2);
		vec[5]=((1-MC_RT[casenum])+deviationvalue1)*(MR_RT[casenum])*((1-MP_RT[casenum])+deviationvalue2);
		vec[6]=((1-MC_RT[casenum])+deviationvalue1)*((1-MR_RT[casenum]))*(MP_RT[casenum]-deviationvalue2);
		vec[7]=((1-MC_RT[casenum])+deviationvalue1)*((1-MR_RT[casenum]))*((1-MP_RT[casenum])+deviationvalue2);
		
		return vec;
		
	}

	
	
}
